package com.zige.zige.activity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.zige.zige.R;
import com.zige.zige.utils.NetworkUtils;

/**
 * Created by SONY-SONG on 2015/3/23.
 */
public class NetErrorActivity extends BaseActivity {

    private LinearLayout lay_back;
    private TextView tv_title,tv_setting;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_net_error);
        initView();

    }

    private void initView() {
        lay_back = serchViewById(R.id.lay_back);
        lay_back.setOnClickListener(new View.OnClickListener() {
           @Override
           public void onClick(View v) {
               if(NetworkUtils.isNetworkAvailable(NetErrorActivity.this)){
                   startActivity(new Intent(NetErrorActivity.this,NetErrorActivity.class));
                   finish();
               }else {
                   finish();
                   overridePendingTransition(R.anim.r2l_in, R.anim.r2l_out);
               }

           }
       });
        tv_title = (TextView) findViewById(R.id.title_name);
        tv_title.setText("不能连接网络");
        tv_setting = serchViewById(R.id.tv_setting);
        tv_setting.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                setNet(v);
            }
        });

    }

    public void setNet(View view) {
        Intent intent = new Intent("android.settings.WIFI_SETTINGS");
        startActivity(intent);
    }
}
